home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Programmer Disk
/
The Programmer Disk (Microforum).iso
/
xpro
/
c2
/
pro4
/
cflowd.c
< prev
next >
Wrap
Text File
|
1986-04-29
|
3KB
|
170 lines
/* «RM120»«PL99999»«TS4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76» */
#include <stdio.h>
#define EXTERN extern
#include <typedef.h>
void DrawArrowHor(X1, Y1, X2, Y2)
int X1, Y1, X2, Y2;
{
DrawLine((double)X1,(double)Y1,(double)X2,(double)Y2);
if (X2 > X1) {
DrawLine((double)(X2-4),(double)(Y2-2),(double)X2,(double)Y2);
DrawLine((double)(X2-4),(double)(Y2+2),(double)X2,(double)Y2);
}
else {
DrawLine((double)(X2+5),(double)(Y2-2),(double)X2,(double)Y2);
DrawLine((double)(X2+5),(double)(Y2+2),(double)X2,(double)Y2);
}
}
void DrawArrowVer(X1,Y1,X2,Y2)
int X1, Y1, X2, Y2;
{
DrawLine((double)X1,(double)Y1,(double)X2,(double)Y2);
if (Y2>Y1) {
DrawLine((double)(X2-2),(double)(Y2-3),(double)X2,(double)Y2);
DrawLine((double)(X2+2),(double)(Y2-3),(double)X2,(double)Y2);
}
else {
DrawLine((double)(X2-2),(double)(Y2+3),(double)X2,(double)Y2);
DrawLine((double)(X2+2),(double)(Y2+3),(double)X2,(double)Y2);
}
}
void Blink(Count,time)
int Count, time;
{
int i;
for (i=1; i <= Count; i++) {
Delay(time);
InvertWindow();
}
}
void Delay(time)
int time;
{
long i, j;
j = 10L * time;
for (i = 0L; i < j; i++)
;
}
main()
{
char *Temp;
static char str[4] = {"I="};
int Count;
InitGraphic();
DefineWindow(1,0,0,79,185);
DefineWindow(2,12,20,25,40);
DefineWindow(3,15,55,22,75);
DefineWindow(4,11,110,26,130);
DefineWindow(5,47,90,56,110);
ClearScreen();
SetColorWhite();
DefineHeader(1,"A FLOW CHART");
SetHeaderOn();
SelectWindow(1);
DrawBorder();
SetHeaderOff(0);
SelectWindow(2);
DrawBorder();
DrawText(125,27,2,"START");
SetWindowModeOff();
DrawArrowVer(151,40,151,55);
SetWindowModeOn();
SelectWindow(3);
DrawBorder();
DrawText(136,63,2,"I=1");
SetWindowModeOff();
DrawArrowVer(151,75,151,110);
SetWindowModeOn();
SelectWindow(4);
DrawBorder();
DrawText(108,118,2,"IF I<=5");
DrawStraight(215,417,120);
SetWindowModeOff();
DrawArrowVer(417,120,417,110);
DrawArrowVer(151,130,151,155);
SetWindowModeOn();
SelectWindow(1);
DrawText(300,110,2,"YES");
DrawText(160,137,2,"NO");
SelectWindow(5);
DrawBorder();
DrawText(390,98,2,"I=I+1");
SetWindowModeOff();
DrawLine((double)417,(double)90,(double)417,(double)80);
DrawArrowHor(417,80,151,80);
SetAspect((double)1.0);
DrawCircle((double)151,(double)165,(double)25);
SelectWindow(1);
DrawText(137,163,2,"END");
SetWindowModeOn();
SetHeaderOn();
CopyScreen();
gotoxy(27,25);
DefineWindow(2,15,21,22,39);
SelectWindow(2);
SetBackground(0);
DrawBorder();
InvertWindow();
Delay(1000);
InvertWindow();
Temp = "123456";
str[2]=Temp[0];
MoveVer(35,TRUE);
DrawText(139,63,2,str);
Blink(30,50);
MoveVer(55,TRUE);
for (Count=1; Count<=5; Count++) {
Delay(500);
MoveHor(33,TRUE);
MoveVer(-20,TRUE);
SetBackground(0);
DrawBorder();
str[2]=Temp[Count];
DrawText(400,98,2,str);
Blink(30,50);
MoveVer(-20,TRUE);
MoveHor(-33,TRUE);
MoveVer(40,TRUE);
}
InvertWindow();
Delay(1000);
MoveVer(46,TRUE);
Blink(30,50);
MoveHor(45,TRUE);
MoveVer(-136,TRUE);
MoveHor(-45,TRUE);
SetHeaderOn();
inkey();
LeaveGraphic();
}